<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:f="http://java.sun.com/jsf/core">
    <ui:composition template="templates/template.xhtml">
        <h:head>
            <title>Cadastrar Projetistas</title>
        </h:head>
        <ui:define name="content">
            <h:body>
                <h:form>
                    <center>
                        <!-- Painel -->
                        <p:panel id="panel" header="Projetista" style="width: 860px">  
                            <h:panelGrid columns="3">  



                                <h:outputLabel for="nome"  value="Nome: *" />  
                                <p:inputText id="nome" label="Nome" required="true" requiredMessage="Campo obrigatório"
                                             value="#{projetistaBean.projetista.nome}" size="50" maxlength="100" />
                                <p:message for="nome" />  

                                <h:outputLabel for="e-mail" value="E-mail: *"/>
                                <p:inputText id="e-mail" label="e-mail" required="true"  requiredMessage="Campo obrigatório"
                                             value="#{projetistaBean.projetista.EMail}" size="50" maxlength="100"/>
                                <p:message for="e-mail" />  

                                <h:outputLabel for="senha" value="Senha: *"/> 
                                <p:password value="#{projetistaBean.projetista.senha}" size="50" maxlength="20" feedback="false" id="senha" 
                                            label="senha" required="true"  requiredMessage="Campo obrigatório"/>
                                <p:message for="senha" />  
                            </h:panelGrid>  
                        </p:panel>  
                    </center>


                    <br>
                        <center>
                            <p:commandButton id="salvar" value="Salvar" actionListener="#{projetistaBean.salvar()}" update="panel,resultado" 
                                             image="ui-icon ui-icon-disk" title="Salvar" process="@this,panel"/>

                            <p:commandButton id="excluir" value="Excluir" actionListener="#{projetistaBean.excluir()}" update="panel,resultado" 
                                             image="ui-icon ui-icon-trash" title="Excluir" process="@this,panel,resultado">
                                <p:confirmDialog message="Deseja excluir este registro?" />
                            </p:commandButton>
                        </center>
                    </br>
                    <!-- Botões -->






                    <!-- Tabela -->
                    <center>
                        <p:dataTable id="resultado" var="projetista" style="width: 860px" value="#{projetistaBean.projetistas}" 
                                     selection="#{projetistaBean.projetista}" selectionMode="single" 
                                     update="panel">

                            <f:facet name="header">
                                Projetistas Cadastrados
                            </f:facet>

                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="Nome"/>
                                </f:facet>
                                <h:outputText value="#{projetista.nome}"/>
                            </p:column>

                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="e-mail"/>
                                </f:facet>
                                <h:outputText value="#{projetista.EMail}"/>
                            </p:column>

                        </p:dataTable>
                    </center>

                    <br>
                        <center>
                            <p:commandButton value="Voltar" image="imagens/new_project.png" action="login.xhtm" ajax="false"/>
                            <f:param name="productId" value="20"/>
                        </center>
                    </br>
                </h:form>

            </h:body>
        </ui:define>

    </ui:composition>
</html>

